import { Container } from "react-bootstrap";
import Login from "../Component/Login";
import { useNavigate } from "react-router-dom";

function LoginRegisterPage({ type }) {
    const navigate = useNavigate();

    return (
        <Container>
            <h1 className="text-center">{type === 'login' ? '登录' : '注册'}</h1>
            <Login className="col-sm-11 col-md-6" onSuccess={ () => {
                if (type === 'login')
                    navigate('/');
                else
                    navigate('/login');
            }} type={type} />
        </Container>
    );
}

export default LoginRegisterPage;